package pvn.com.utils;

import pvn.com.interfaces.IObjectMessageListener;
import java.util.Timer;
import java.util.TimerTask;
import net.rim.device.api.ui.UiApplication;

public class MessageTimer {
    IObjectMessageListener target;
    int msg;
    TimerTask msgTask = null;
    Timer msgTimer = new Timer();

    public MessageTimer(IObjectMessageListener _target, int _msg, int milliseconds) {
        this.target = _target;
        this.msg = _msg;
        this.msgTask = new TimerTask() {

            public void run() {

                UiApplication.getUiApplication().invokeLater(new Runnable() {

                    public void run() {
                        // TODO Code xu ly runable message.
                    }
                });

            }
        };
        this.msgTimer.scheduleAtFixedRate(this.msgTask, milliseconds, milliseconds);
    }
}